//引入封装好的接口
import { menuList } from '@/request/api'


//封装一个接口数据类型
interface stateMenu {
    list: Array<Object>
}


const state = {
    list: []
}

const getters = {
    getMenu(state: stateMenu) {
        return state.list
    }
}

const mutations = {
    mutationsList(state: stateMenu, payload: any) {
        state.list = payload
    }
}

const actions = {
    listActions(context: any) {
        menuList().then((res: any) => {
            // console.log(res);
            context.commit('mutationsList', res.list)
        })
    }
}


export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}